/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Newgame;

import Global.ConnectDB;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.awt.EventQueue;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
 *
 * @author Administrator
 */
public class Gameplay extends javax.swing.JFrame {
    ConnectDB connectdb;
    PreparedStatement st;
    ResultSet rs; 
    private Timer timer = new Timer();
    
    /**
     * Creates new form Gameplay
     */
    public Gameplay() {
        initComponents();
        connectdb = new ConnectDB("1433","localhost","mssqlserver","eproject1","sa","123");
        connectdb.openConnection();
        st = null;
        rs = null;
        timer.schedule(new UpdateUITask(), 0, 1000);
    }
     private class UpdateUITask extends TimerTask {

        int nSeconds = 0;

        @Override
        public void run() {
            EventQueue.invokeLater(new Runnable() {

                @Override
                public void run() {
                    timeLabel.setText(String.valueOf(nSeconds++));
                }
            });
        }
     }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panel1 = new java.awt.Panel();
        txf1_1 = new javax.swing.JTextField();
        txf1_2 = new javax.swing.JTextField();
        txf1_3 = new javax.swing.JTextField();
        txf1_4 = new javax.swing.JTextField();
        txf2_1 = new javax.swing.JTextField();
        txf2_2 = new javax.swing.JTextField();
        txf2_3 = new javax.swing.JTextField();
        txf2_4 = new javax.swing.JTextField();
        txf3_1 = new javax.swing.JTextField();
        txf3_2 = new javax.swing.JTextField();
        txf3_3 = new javax.swing.JTextField();
        txf3_4 = new javax.swing.JTextField();
        txf4_1 = new javax.swing.JTextField();
        txf4_2 = new javax.swing.JTextField();
        txf4_3 = new javax.swing.JTextField();
        txf4_4 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList2 = new javax.swing.JList();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        timeLabel = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(820, 540));
        setPreferredSize(new java.awt.Dimension(860, 540));
        setResizable(false);
        getContentPane().setLayout(null);

        panel1.setLayout(null);

        txf1_1.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf1_1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txf1_1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txf1_1ActionPerformed(evt);
            }
        });
        panel1.add(txf1_1);
        txf1_1.setBounds(0, 1, 69, 71);

        txf1_2.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf1_2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf1_2);
        txf1_2.setBounds(70, 1, 69, 71);

        txf1_3.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf1_3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf1_3);
        txf1_3.setBounds(140, 1, 69, 71);

        txf1_4.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf1_4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf1_4);
        txf1_4.setBounds(210, 1, 69, 71);

        txf2_1.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf2_1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf2_1);
        txf2_1.setBounds(0, 73, 69, 71);

        txf2_2.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf2_2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf2_2);
        txf2_2.setBounds(70, 73, 69, 71);

        txf2_3.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf2_3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf2_3);
        txf2_3.setBounds(140, 73, 69, 71);

        txf2_4.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf2_4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf2_4);
        txf2_4.setBounds(210, 73, 69, 71);

        txf3_1.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf3_1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf3_1);
        txf3_1.setBounds(0, 145, 69, 71);

        txf3_2.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf3_2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf3_2);
        txf3_2.setBounds(70, 145, 69, 71);

        txf3_3.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf3_3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf3_3);
        txf3_3.setBounds(140, 145, 69, 71);

        txf3_4.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf3_4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf3_4);
        txf3_4.setBounds(210, 145, 69, 71);

        txf4_1.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf4_1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf4_1);
        txf4_1.setBounds(0, 217, 69, 71);

        txf4_2.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf4_2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf4_2);
        txf4_2.setBounds(70, 217, 69, 71);

        txf4_3.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf4_3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf4_3);
        txf4_3.setBounds(140, 217, 69, 71);

        txf4_4.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
        txf4_4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        panel1.add(txf4_4);
        txf4_4.setBounds(210, 217, 69, 71);

        getContentPane().add(panel1);
        panel1.setBounds(60, 90, 280, 290);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/accross_new.png"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(410, 50, 160, 50);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/down_new.png"))); // NOI18N
        getContentPane().add(jLabel2);
        jLabel2.setBounds(410, 220, 160, 50);

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jList1);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(410, 100, 320, 90);

        jList2.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(jList2);

        getContentPane().add(jScrollPane2);
        jScrollPane2.setBounds(410, 270, 320, 90);

        jButton1.setText("Quit");
        getContentPane().add(jButton1);
        jButton1.setBounds(80, 460, 60, 23);

        jButton2.setText("Submit");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2);
        jButton2.setBounds(340, 460, 65, 23);

        timeLabel.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        timeLabel.setForeground(new java.awt.Color(255, 204, 51));
        getContentPane().add(timeLabel);
        timeLabel.setBounds(640, 20, 120, 30);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Clock.png"))); // NOI18N
        jLabel3.setText("jLabel3");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(564, 14, 50, 40);

        jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 204, 0));
        jLabel5.setText("Sec");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(730, 20, 60, 30);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/alphabet-f-alphabets-81026.jpg"))); // NOI18N
        getContentPane().add(jLabel4);
        jLabel4.setBounds(0, 0, 860, 530);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txf1_1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txf1_1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txf1_1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
            
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Gameplay.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Gameplay.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Gameplay.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Gameplay.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Gameplay().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JList jList1;
    private javax.swing.JList jList2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private java.awt.Panel panel1;
    private javax.swing.JLabel timeLabel;
    private javax.swing.JTextField txf1_1;
    private javax.swing.JTextField txf1_2;
    private javax.swing.JTextField txf1_3;
    private javax.swing.JTextField txf1_4;
    private javax.swing.JTextField txf2_1;
    private javax.swing.JTextField txf2_2;
    private javax.swing.JTextField txf2_3;
    private javax.swing.JTextField txf2_4;
    private javax.swing.JTextField txf3_1;
    private javax.swing.JTextField txf3_2;
    private javax.swing.JTextField txf3_3;
    private javax.swing.JTextField txf3_4;
    private javax.swing.JTextField txf4_1;
    private javax.swing.JTextField txf4_2;
    private javax.swing.JTextField txf4_3;
    private javax.swing.JTextField txf4_4;
    // End of variables declaration//GEN-END:variables
}
